﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Core.Business;

namespace Util
{
    public static class TicketUtil
    {
        public static String getParentName(int parentId, string parentType)
        {
            String parentName = "";
            if (parentType == "STAFFS")
            {
                StaffBus staffBus = new StaffBus();
                Core.Entity.Staff staff = staffBus.get(parentId);
                parentName = staff.FullName;
            }
            else
            {
                AccountBus accountBus = new AccountBus();
                Core.Entity.Account account = accountBus.get(parentId);
                parentName = account.OwnerName;
            }

            return parentName;
        }

        public static String displayAttachment(String attachment1, String attachment2, String attachment3)
        {
            String attachment = "";
            if (attachment1 != "")
            {
                attachment += "Hình minh họa 1: <a href='/Assets/data/" + attachment1 + "' target='_blank'>" + attachment1 + "</a><br/>";
            }
            if (attachment2 != "")
            {
                attachment += "Hình minh họa 2: <a href='/Assets/data/" + attachment2 + "' target='_blank'>" + attachment2 + "</a><br/>";
            }
            if (attachment3 != "")
            {
                attachment += "Hình minh họa 3: <a href='/Assets/data/" + attachment3 + "' target='_blank'>" + attachment3 + "</a>";
            }
            return attachment;
        }
    }
}